import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { orderhisrecordVO, orderhisrecordForm, orderhisrecordQuery } from '@/api/event/orderHisRecord/types';

/**
 * 查询工单历史列表
 * @param query
 * @returns {*}
 */

export const listorderhisrecord = (query?: orderhisrecordQuery): AxiosPromise<orderhisrecordVO[]> => {
  return request({
    url: '/event/orderHisRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工单历史详细
 * @param workOrderHisRecordId
 */
export const getorderhisrecord = (workOrderHisRecordId: string | number): AxiosPromise<orderhisrecordVO> => {
  return request({
    url: '/event/orderHisRecord/' + workOrderHisRecordId,
    method: 'get'
  });
};

/**
 * 新增工单历史
 * @param data
 */
export const addorderhisrecord = (data: orderhisrecordForm) => {
  return request({
    url: '/event/orderHisRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改工单历史
 * @param data
 */
export const updateorderhisrecord = (data: orderhisrecordForm) => {
  return request({
    url: '/event/orderHisRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除工单历史
 * @param workOrderHisRecordId
 */
export const delorderhisrecord = (workOrderHisRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/event/orderHisRecord/' + workOrderHisRecordId,
    method: 'delete'
  });
};
